<?php
/**
 * logout.php
 * 
 * This file contains the code for the webpage users are directed to when they logout.
 */
error_reporting (E_ALL ^ E_NOTICE);
session_start();
$userid = $_SESSION['userid'];
$username = $_SESSION['username'];

require_once 'interface.php';
webpageDoctype();
print_html_title("Member System - Logout");
webpageMetaAndBodyStart();
echo "<p><div align='center'>";
	
	if (strlen($username) > 0 && strlen($userid) > 0) {
		unset($_SESSION['userid']);
		unset($_SESSION['username']);
		session_destroy();
		echo <<<EOL
		<meta http-equiv="Refresh" content="0; url=logout.php" />
EOL;
		echo "You have been logged out.";
	}else{
		echo "You are not logged in.";
	}
	echo "<p><a href='login.php'>Return to Login Page</a></p>";
	
echo "</div></p>";
webpageFooter();
?>
